//
//  ViewController.swift
//  SchemeWithParameterDemo
//
//  Created by kingseraphs on 09/05/2017.
//  Copyright © 2017 kingseraphs. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var usernameText: UITextField!
    @IBOutlet weak var passwordText: UITextField!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        NotificationCenter.default.addObserver(self, selector: #selector(urlMessageOpened(sender:)), name: NSNotification.Name(rawValue: ApplicationDidOpenUrlKey), object: nil)
    }

    @objc private func urlMessageOpened(sender: NSNotification) {
        if let obj = sender.object as? [String: String]{
            usernameText.text = obj["username"]
            passwordText.text = obj["phone"]
        }
    }

}

